﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EF5;


namespace DataContextLayer
{
    /// <summary>
    /// User Profile class
    /// Contains values about the user
    /// </summary>
    
    public class UserProfile
    {
        /// <summary>
        /// User static propertys
        /// </summary>
        public static string UserName { get; private set; }
        public static int UserId { get; private set; }
        public static bool UserPasswordReset { get; private set; }
        public static bool UserTutorialLanguagePrefrence { get; private set; }
        public static int UserAchievementPoints { get; set; }

        public static List<Tutorial> TutorialList { get; private set; }
        public static List<Tutorial> CsharpList { get; private set; }
        public static List<Tutorial> JavaList { get; private set; }
        
        public static string CurrentLanguage { get; set; }
        public static string CurrentSnippet{ get; set; }
        public static string CurrentTutorial { get; set; }


        /// <summary>
        /// Gets the user from Login & Registration
        /// </summary>
        /// <param name="userList"></param>
        public static void GetUserList(IEnumerable<User> userList)
        {
            TutorialList = new List<Tutorial>();
            //Go threw each value in user
            foreach (var user in userList)
            {
                UserId = user.UserId;
                UserName = user.UserName;
                UserPasswordReset = user.UserPasswordReset;
                UserTutorialLanguagePrefrence = user.UserTutorialLanguagePrefrence;
                UserAchievementPoints = 5;
                foreach (var tutorial in user.Tutorials)
                {
                    TutorialList.Add(tutorial);
                }
            }
        }
        //public static IEnumerable<string> GetRecentTutorials()
        //{

        //    var recents = from dt in TutorialList
        //                  orderby dt.TutorialStarted descending 
        //                  select dt.TutorialName;

        //    return recents;
        //}
       
    }
    
}
